#include <iostream>
using namespace std;

const int N = 205;
int to[N];
int dis[N]; //起点到每个点最短距离
int n;

void dfs(int k, int a)
{
	if (dis[a] <= k) return;
	dis[a] = k; //刷新到a的最短距离
	
	if (a + to[a] <= n) dfs(k + 1, a + to[a]);
	if (a - to[a] >= 1) dfs(k + 1, a - to[a]);
}


int main()
{
	int  a, b;
	cin >> n >> a >> b;
	for (int i = 1; i <= n; i++) {
		cin >> to[i]; //输入每个按钮的值
		dis[i] = n + 1;
	}
	dfs(0, a);
	printf("%d\n", dis[b] == n + 1 ? -1 : dis[b]);

	return 0;
}
